import { hiprint } from 'vue-plugin-hiprint';
// 自定义设计元素1
export const aProvider = function () {
  var addElementTypes = function (context) {
    context.removePrintElementTypes('taskProviderModule');
    context.addPrintElementTypes('taskProviderModule', [
      new hiprint.PrintElementTypeGroup('自定义组件', [
        {
          tid: 'taskProviderModule.title',
          title: '标题抬头',
          data: 'XXXXXX有限公司',
          type: 'text',
          options: {
            field: 'title',
            testData: 'XXXXXX有限公司',
            fontSize: 20,
            fontWeight: '700',
            textAlign: 'center',
            hideTitle: true,
            width: 200,
            height: 25,
            textContentVerticalAlign: 'middle'
          }
        },
        {
          tid: 'taskProviderModule.header',
          title: '单据表头',
          data: 'XXXXX单',
          type: 'text',
          options: {
            field: 'header',
            testData: 'XXXXX单',
            height: 17,
            fontSize: 12,
            textAlign: 'center',
            hideTitle: true,
            textContentVerticalAlign: 'middle'
          }
        },
        {
          tid: 'taskProviderModule.order',
          title: '订单编号',
          data: 'CK8888888888',
          type: 'text',
          options: {
            field: 'orderId',
            testData: 'CK8888888888',
            height: 16,
            fontSize: 12,
            textAlign: 'left',
            textContentVerticalAlign: 'middle'
          }
        },
        {
          tid: 'taskProviderModule.leader',
          title: '负责人',
          data: '张三',
          type: 'text',
          options: {
            field: 'leader',
            testData: '张三',
            height: 16,
            fontSize: 12,
            textAlign: 'left',
            textContentVerticalAlign: 'middle'
          }
        },
        {
          tid: 'taskProviderModule.date',
          title: '日期',
          data: '2020-01-01',
          type: 'text',
          options: {
            field: 'date',
            testData: '2020-01-01',
            height: 16,
            fontSize: 12,
            textAlign: 'left',
            textContentVerticalAlign: 'middle'
          }
        },
        {
          tid: 'taskProviderModule.barcode',
          title: '条形码',
          data: '123456798456',
          type: 'text',
          options: {
            field: 'barcode',
            testData: '123456798456',
            height: 32,
            fontSize: 12,
            lineHeight: 18,
            textType: 'barcode',
            textAlign: 'center'
          }
        },
        {
          tid: 'taskProviderModule.qrcode',
          title: '二维码',
          data: 'CK8888888888',
          type: 'text',
          options: {
            field: 'qrcode',
            testData: 'CK8888888888',
            width: 50,
            height: 50,
            fontSize: 12,
            lineHeight: 18,
            textType: 'qrcode',
            hideTitle: true,
            textAlign: 'center'
          }
        },
        {
          tid: 'taskProviderModule.logo',
          title: 'Logo',
          data: '',
          type: 'image',
          options: {
            field: 'logo',
            testData:'',
            width: '60',
            height: '60'
          }
        }
      ])
    ]);
  };
  return {
    addElementTypes: addElementTypes
  };
};

export default aProvider();
